Skip to content

fix(git): reset sync target to fetched commit#81

Merged
yyzxw merged 1 commit into
BaizeAI:mainfrom
usernameisnull:fix/multiple-sync-error
Jul 20, 2026
Merged

fix(git): reset sync target to fetched commit#81
yyzxw merged 1 commit into
BaizeAI:mainfrom
usernameisnull:fix/multiple-sync-error

Conversation

@usernameisnull

Copy link
Copy Markdown
Contributor

Replace git pull with git fetch followed by
git reset --hard FETCH_HEAD for Git data synchronization.

When reusing an existing directory, the loader now aligns the local repository
with the exact fetched remote commit. This prevents failures when local and
remote branches have diverged or when the remote branch history was rewritten.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the Git synchronization logic in GitLoader to perform a git fetch followed by a git reset --hard FETCH_HEAD instead of a git pull. This change replaces the resetHardToTargetBranch method with a more generic resetHardToRef method and removes the early hard reset before fetching. Additionally, a new test TestGitLoaderSyncResetsDivergedRepository has been added, and existing tests have been updated to reflect the new Git command sequence. There are no review comments, and I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@yyzxw

yyzxw commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

/lgtm

@yyzxw
yyzxw merged commit 0ec7e60 into BaizeAI:main Jul 20, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants